<template>
	<view>
		<uni-list>
		 <view v-for="notice in rows" :key="notice.noticeId" @click="showDetail(notice.noticeId)">
		 	<uni-list-item 
			:title="notice.noticeTitle" 
			:rightText="notice.createBy" 
			showArrow />
		 </view>
	    </uni-list>
		<view class="btn-view">
		  <uni-pagination :current="current" :pageSize="pageSize" :total="total" @change="change"/>
		</view>
	</view>
</template>

<script>
	import { getNoticeList } from "@/api/system/notice"
	
	export default {
		components: {},
		data() {
			return {
				current: 1,
				total: 50,
				pageSize: 10,
				rows: []
			}
		},
		onLoad() {
			this.getList(this.current,this.pageSize)
		},
		methods: {
			getList(pageNum,pageSize){
				getNoticeList({pageNum:pageNum,pageSize:pageSize}).then(response=>{
					this.total = response.total
                    this.rows = response.rows
				})
			},
			change(e){
				this.getList(e.current,this.pageSize)
			},
			
			showDetail(id) {
			  // console.log(id)
			  this.$tab.navigateTo(`/pages/work/notice/detail?id=`+id)
			}
		}
	}
</script>


<style lang="scss">
	.example-body {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
	}

	.btn-view {
		/* #ifndef APP-NVUE */
		display: flex;
		flex-direction: column;
		/* #endif */
		padding: 10px;
		text-align: center;
		background-color: #fff;
		position:fixed; 
		bottom:0;
		width: 100%;
	}

	.btn-flex {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}

	.button {
		margin: 20px;
		width: 150px;
		font-size: 14px;
		color: #333;
	}
</style>


